package com.frame;
import java.util.Calendar;
import java.util.Random;

public class Sequence_Id {
	
	private int year;
	private int month;
	private int day;
	private int hours;
	private int minutes;
	private int seconds;
	private int milliseconds;
	private int random;
	
	public Sequence_Id(){
		
	
		
	}
	
	public void init(){
		Calendar rightNow = Calendar.getInstance(); 
		Random random_temp=new Random();
		this.year=rightNow.get(rightNow.YEAR); 
		this.month=rightNow.get(rightNow.MONTH)+1; 
		this.day=rightNow.get(rightNow.DATE); 
		this.hours=rightNow.get(rightNow.HOUR);
		this.minutes=rightNow.get(rightNow.MINUTE);
		this.seconds=rightNow.get(rightNow.SECOND);
		this.milliseconds=rightNow.get(rightNow.MILLISECOND);
		this.random=random_temp.nextInt(10);
	}
	
	public String getId(){
		String str=String.valueOf(this.year);	
		str+=String.valueOf( String.format("%02d", this.month));
		str+=String.valueOf( String.format("%02d", this.day));
		str+=String.valueOf( String.format("%02d", this.hours));
		str+=String.valueOf( String.format("%02d", this.minutes));
		str+=String.valueOf( String.format("%02d", this.seconds));
		str+=String.valueOf( String.format("%03d", this.milliseconds));
		str+=this.random;
		System.out.println(str);
		return str;
	}
}








